<?php
/*
 * Created on 22.12.2005
 *
 */

class c_outHandler 
{

    function startElement (& $sender, $attrs)
    {
        if (empty($attrs['value']))
        {
            die ("Attribute value is missing in out tag\n");
        }
        if (isset($attrs['escape']) && $attrs['escape'])
        {
            if ($attrs['escape'] == "'all'")
            {
                $attrs['value'] = 'htmlentities('.$attrs['value'].', ENT_COMPAT, MODEL2_ENCODING)';
            } elseif ($attrs['escape'] == "'special'")
            {
                $attrs['value'] = 'htmlspecialchars('.$attrs['value'].', ENT_COMPAT, MODEL2_ENCODING)';
            } elseif ($attrs['escape'] == "'none'")
            {
            } else
            {
                $attrs['value'] = 'htmlspecialchars('.$attrs['value'].', ENT_COMPAT, MODEL2_ENCODING)';
            }
        }
        else
            $attrs['value'] = 'htmlspecialchars('.$attrs['value'].', ENT_COMPAT, MODEL2_ENCODING)';
        if (!empty($attrs['var']))
            $sender->appendCode('$actionform->set('.$attrs['var'].', '.$attrs['value'].');'."\n");
        else
            $sender->appendCode('$out->write('.$attrs['value'].');'."\n");
    }
    
    function endElement (& $sender)
    {
    
    }

}

?>
